 |
|
 |
Subject: Rich Text Alignment |
 |
 |
 |
Product Area: Notes Client |
 |
Technical Area: Functionality |
 |
Platform: Windows Vista client |
 |
Release: 8.5 |
 |
Reproducible: Always |
 |
 |
 |
 |
I am trying to build a report within a NotesRichTextItem. The report will includ text, which will be
either centered or left-justified, and tables with fixed width columns. To illustrate the setup,
I create a form called "Report" containing a single Rich Text field called "rtField". Then run the
following agent:
Sub Initialize
Dim session As New NotesSession
Dim ws As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim rtLeft As NotesRichTextParagraphStyle
Dim rtCenter As NotesRichTextParagraphStyle
Dim tblstyle (1 To 2) As NotesRichTextParagraphStyle
Dim rtField As NotesRichTextItem
Dim nav As NotesRichTextNavigator
Dim table As NotesRichTextTable
Set db=session.CurrentDatabase
Set doc=db.CreateDocument()
Set rtLeft=session.CreateRichTextParagraphStyle
Set rtCenter=session.CreateRichTextParagraphStyle
Set tblstyle(1)=session.CreateRichTextParagraphStyle
Set tblstyle(2)=session.CreateRichTextParagraphStyle
rtLeft.Alignment=ALIGN_LEFT
rtCenter.Alignment=ALIGN_CENTER
tblstyle(1).FirstLineLeftMargin=0
tblstyle(2).FirstLineLeftMargin=0
tblstyle(1).LeftMargin=0
tblstyle(2).LeftMargin=0
tblstyle(1).RightMargin=RULER_ONE_INCH * 2
tblstyle(2).RightMargin=RULER_ONE_INCH * 2
doc.form="Report"
Call doc.CreateRichTextItem("rtField")
Set rtField=doc.GetFirstItem("rtField")
Set nav=rtField.CreateNavigator
Call rtField.AppendParagraphStyle(rtCenter)
Call rtField.AppendText("This text should be centered.")
Call rtField.AddNewline(1)
Call rtField.AppendParagraphStyle(rtLeft)
Call rtField.AppendText("This text should be left justified.")
Call rtField.AddNewline(1)
Call rtfield.AppendTable(2,2,,,tblstyle)
Call nav.FindFirstElement(RTELEM_TYPE_TABLE)
Set table=nav.GetElement
Call nav.FindFirstElement(RTELEM_TYPE_TABLECELL)
rtfield.BeginInsert(nav)
Call rtfield.AppendText("1")
Call rtfield.EndInsert
Call nav.FindNextElement(RTELEM_TYPE_TABLECELL)
rtfield.BeginInsert(nav)
Call rtfield.AppendText("2")
Call rtfield.EndInsert
Call nav.FindNextElement(RTELEM_TYPE_TABLECELL)
rtfield.BeginInsert(nav)
Call rtfield.AppendText("3")
Call rtfield.EndInsert
Call nav.FindNextElement(RTELEM_TYPE_TABLECELL)
rtfield.BeginInsert(nav)
Call rtfield.AppendText("4")
Call rtfield.EndInsert
Call rtfield.AddNewline(1)
Call rtfield.AppendParagraphStyle(rtCenter)
Call rtField.AppendText("This text should be centered.")
Call rtField.AddNewline(1)
Call rtField.AppendParagraphStyle(rtLeft)
Call rtField.AppendText("This text should be left justified.")
Call rtField.AddNewline(1)
Call rtField.AppendParagraphStyle(rtCenter)
Call rtField.AppendText("This text should be centered.")
Call doc.Save(True,False)
Call ws.EditDocument(False,Doc)
End Sub
In the resulting document, text appearing before the table is correctly aligned, but
text after the table cannot be centered. How can I fix this?
 
Feedback number WEBB7YYTMW created by ~Lex Opjipylitli on 12/22/2009

Status: Open
Comments:

|
|  |
|